﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

using LINQToolKit.Douban.Entities;
using LINQToolKit.Processors;

namespace LINQToolKit.Douban.Processors
{
    public sealed class TimeDurationProcessor : PropertyProcessor
    {
        public override object FromXml(Mapping.MetaProperty meta, IEnumerable<XElement> elements)
        {
            var e = elements.First();

            return new TimeDuration
            {
                Start = e.Attribute("startTime").GetDateTime(),
                End = e.Attribute("endTime").GetDateTime()
            };
        }
    }
}
